/**
 *
 * author ThuanLT
 * Aug 20, 2014
 *
 */

package vn.fsoft.gst.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.stereotype.Repository;
@Repository
@Entity
@Table(name = "address")
public class Address {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "AddressID")
	private int addressID;
	
	public Address() {		
	}

	public Address(String postCode) {
		super();
		this.postCode = postCode;
		this.isActive = true;
	}


	public Address(int addressID, String postCode, boolean isActive, Town town,
			Country country, County county) {
		super();
		this.addressID = addressID;
		this.postCode = postCode;
		this.isActive = isActive;
		this.town = town;
		this.country = country;
		this.county = county;
	}

	public int getAddressID() {
		return addressID;
	}

	public void setAddressID(int addressID) {
		this.addressID = addressID;
	}

	public String getPostCode() {
		return postCode;
	}

	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}

	public boolean getIsActive() {
		return isActive;
	}

	public void setIsActive(boolean isActive) {
		this.isActive = isActive;
	}

	public Town getTown() {
		return town;
	}

	public void setTown(Town town) {
		this.town = town;
	}

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	public County getCounty() {
		return county;
	}

	public void setCounty(County county) {
		this.county = county;
	}
	
	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public List<Organisation> getListOrganisations() {
		return listOrganisations;
	}

	public void setListOrganisations(List<Organisation> listOrganisations) {
		this.listOrganisations = listOrganisations;
	}

	@Column(name = "PostCode",columnDefinition="char(5)")
	private String postCode;

	@Column(name = "Street")
	private String street;
	
	@Column(name = "IsActive")
	private boolean isActive;

	@ManyToOne
	@JoinColumn(name = "TownID")
	private Town town;

	@ManyToOne
	@JoinColumn(name = "CountryID")
	private Country country;

	@ManyToOne
	@JoinColumn(name = "CountyID")
	private County county;
	
	@OneToMany(mappedBy="address")
	private List<Organisation> listOrganisations;

}
